package cn.edu.zju.gis.disasterBE.sever.dao;

import cn.edu.zju.gis.disasterBE.sever.entity.News;
import cn.edu.zju.gis.disasterBE.sever.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface NewsDAO extends BaseMapper<News> {

    //发布新闻
    default boolean articlePost(News news)
    {
        System.out.println(news);
        return this.insert(news) > 0;
    }

    //根据发布时间降序获取新闻
    @Select("select * from news order by posttime desc")
    List<News> getArticleAll();
    //根据新闻ID删除新闻
    @Delete("delete from news where nid = #{nid}")
    int deleteArticleByID(Integer nid);
}
